package org.example.core.controller;

import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.User;

public class Controller {
    /**
     * 获取当前用户的登陆用户id
     *
     * @return
     */
    public String getUserId() {
        return ((User) SecurityContextHolder.getContext().getAuthentication().getPrincipal()).getUsername();
    }

}
